<div class="box box-solid box-primary">

    <form id="form1">
        <div class="box-header with-border">
            <h3 class="box-title">发货列表</h3>
            <div class="box-tools pull-right">
            </div>
            <!-- /.box-tools -->
        </div>
        <!-- /.box-header -->
        <div class="box-body" style="display: block;">
            <table class="table">
                <thead>
                    <tr>
                        <th>id</th>
                        <th>订单编号</th>
                        <th>收货人</th>
                        <th>手机号码</th>
                        <th>邮政编码</th>
                        <th>收货地址</th>
                        <th>配送方式</th>
                        <th>物流单号</th>
                    </tr>
                </thead>
                <tbody>

                    @foreach($data as $key=>$val)
                        <tr>
                            <td>{{$val['id']}}</td>
                            <td>{{$val['order_sn']}}</td>
                            <td>{{$val['address']['linkman']}}</td>
                            <td>{{$val['address']['mobile']}}</td>
                            <td></td>
                            <td>{{$val['address']['address']}}</td>
                            <td>
                                <select class="form-control" name="express[{{$val['id']}}][express_code]" >
                                    @foreach($express as $k=>$v)
                                        <option value="{{$v['express_id']}}">{{$v['express_name']}}</option>
                                    @endforeach
                                </select>
                            </td>
                            <td><input type="text" name="express[{{$val['id']}}][express_sn]"></td>
                        </tr>
                    @endforeach

                </tbody>
            </table>
        </div>
        <!-- /.box-body -->

        <div class="box-footer">
            <input type="hidden" name="_token" value="{{csrf_token()}}">
            <div class="col-md-2">
            </div>
            <div class="col-md-8">
                <div class="btn-group pull-right">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </div>
        </div>
    </form>

    <script>
        $(function () {

            $('#form1').on('submit', function (event) {

                event.preventDefault();

                $.post('/order/batchDeliver',$(this).serialize(),function(data){
                    if (data.status) {
                        $.pjax.reload('#pjax-container');
                        swal(data.message, '', 'success');
                    } else {
                        swal(data.message, '', 'error');
                    }
                });
            });
        })
    </script>
</div>